package com.zzh.tree;

import java.util.ArrayList;
import java.util.List;

public class No145_postorderTraversal {
    public static void main(String[] args) {

    }
}
class No145Solution{
    private List<Integer> list;
    public List<Integer> postorderTraversal(TreeNode root) {
        if (root==null){
            return new ArrayList<>();
        }
        list=new ArrayList<>();
        postorder(root);
        return list;
    }
    private void postorder(TreeNode root){
        if (root==null){
            return;
        }
        postorder(root.left);
        postorder(root.right);
        list.add(root.val);
    }
}
